<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Category extends FrontEndController {
    public function __construct() {
        parent::__construct();
    }

    public function getCategory($slug) {
        $this->load->model('repo/product_model', 'product_model');
        $cate = $this->cate_model->getCateBySlug($slug);
        if(count($cate)==0){show_404();}
        $cateProducts = $this->product_model->getCategoryProducts($cate->getId());
        $aReturn = array(
            'pageTitle' => $cate->getTitle(),
            'cate' => $cate,
            'cateProducts' => $cateProducts
            );

        $this->renderView('pages/category', $aReturn);
    }
}
?>